function [X, ImgSetName] = loadImgSet(ImgSet)
% Mordecai Lee, 2017-12-07, Thu, 21:13:09

if ~isempty(fileparts(ImgSet)) % isdir(ImgSet)
    ImgPath = ImgGroundTruth;
else
    ImgPath = srpath.getDataPath(ImgSet);
end

[~, ImgSetName] = fileparts(ImgSet);

MatFile = fullfile(ImgPath, 'Dataset.mat');

if exist(MatFile, 'file')
    X = importdata(MatFile);
    return
end

ImgFiles = srimg.dirimgs(ImgPath, true);
ImgNum = length(ImgFiles);
X = cell(1, ImgNum);
for i = 1 : ImgNum
    X{i} = srimg.imread(fullfile(ImgPath, ImgFiles{i}));
end
save(MatFile, 'X')